﻿using System;

namespace Zadani09.db
{
    [Serializable]
    public class UzivatelSerializable : IConvertible
    {
        public uint IDUzivatel { get; set; }
        public string LoginUzivatel { get; set; }
        public string login_heslo_hash { get; set; }
        public string posledni_zmena_hesla { get; set; }
        public string Jmeno { get; set; }
        public string Email { get; set; }
        public int Stav { get; set; }
        public string ulice { get; set; }
        public string mesto { get; set; }
        public string psc { get; set; }
        public string popisne { get; set; }

        public UzivatelSerializable(Uzivatel uzivatel)
        {
            zkopirujUzivatele(uzivatel);
        }

        public void zkopirujUzivatele(Uzivatel uzivatel)
        {
            this.IDUzivatel = uzivatel.IDUzivatel;
            this.Jmeno = uzivatel.Jmeno;
            this.LoginUzivatel = uzivatel.LoginUzivatel;
            this.login_heslo_hash = uzivatel.LoginHesloHash;
            this.Stav = uzivatel.Stav;
            this.ulice = uzivatel.Ulice;
            this.psc = uzivatel.PSC;
            this.mesto = uzivatel.Mesto;
            this.popisne = uzivatel.Popisne.ToString();
            this.posledni_zmena_hesla = uzivatel.PosledniZmenaHesla.ToString();
            this.Email = uzivatel.Email;
        }

        #region IConvertible Members

        public TypeCode GetTypeCode()
        {
            throw new NotImplementedException();
        }

        public bool ToBoolean(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public byte ToByte(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public char ToChar(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public DateTime ToDateTime(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public decimal ToDecimal(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public double ToDouble(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public short ToInt16(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public int ToInt32(IFormatProvider provider)
        {
            return ((int)this.IDUzivatel);
        }

        public long ToInt64(IFormatProvider provider)
        {
            return ((long)this.IDUzivatel);
        }

        public sbyte ToSByte(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public float ToSingle(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public string ToString(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public object ToType(Type conversionType, IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public ushort ToUInt16(IFormatProvider provider)
        {
            return ((ushort)this.IDUzivatel);
        }

        public uint ToUInt32(IFormatProvider provider)
        {
            return ((uint)this.IDUzivatel);
        }

        public ulong ToUInt64(IFormatProvider provider)
        {
            return ((ulong)this.IDUzivatel);
        }

        #endregion
    }
}
